<!DOCTYPE html>
<html xmlns:wb="http://open.weibo.com/wb">
<head>
  <meta charset="utf-8">
  <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.13/js/linkcard.js"></script>
  <script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?fc9a8559a133f4d8ce784d69d6337bb0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

  
  <title>《maven实战》学习笔记2——maven安装（windows和eclipse插件） | 涂宗勋的博客</title>
  <meta name="baidu-site-verification" content="o8pWlgAEZ7" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="前言由于我的工作中开发环境就是windows，IDE是eclipse，因此安装也只涉及和记录这两部分，在看书和动手的过程也就直接跳过其他部分。">
<meta property="og:type" content="article">
<meta property="og:title" content="《maven实战》学习笔记2——maven安装（windows和eclipse插件）">
<meta property="og:url" content="https://tuzongxun.gitee.io/2017/11/03/maven2/index.html">
<meta property="og:site_name" content="涂宗勋的博客">
<meta property="og:description" content="前言由于我的工作中开发环境就是windows，IDE是eclipse，因此安装也只涉及和记录这两部分，在看书和动手的过程也就直接跳过其他部分。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2017-11-03T07:09:42.000Z">
<meta property="article:modified_time" content="2019-08-13T07:28:19.334Z">
<meta property="article:author" content="涂宗勋">
<meta property="article:tag" content="开发工具">
<meta property="article:tag" content="maven">
<meta name="twitter:card" content="summary">
  
  
    <link rel="icon" href="/images/touxiang.png">
  
  
    
  
  
<link rel="stylesheet" href="/tzxblog/css/style.css">

  

<meta name="generator" content="Hexo 4.2.1"></head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <script src="https://tjs.sjs.sinajs.cn/open/api/js/wb.js" type="text/javascript" charset="utf-8"></script>
  <script src="https://cdn.jsdelivr.net/gh/Sanarous/files@1.13/js/linkcard.js"></script>
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    
    <div id="header-inner" class="inner">
      <nav id="sub-nav">
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://tuzongxun.gitee.io"></form>
      </div>
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/tzxblog/">首页</a>
        
          <a class="main-nav-link" href="/tzxblog/shuoshuo/">说说</a>
        
          <a class="main-nav-link" href="/tzxblog/archives/">归档</a>
        
          <a class="main-nav-link" href="/tzxblog/collections/">导航</a>
        
          <a class="main-nav-link" href="/tzxblog/download/">资源</a>
        
          <a class="main-nav-link" href="/tzxblog/about/">简历</a>
        
      </nav>
      
    </div>
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/tzxblog/" id="logo">涂宗勋的博客</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/tzxblog/" id="subtitle">java程序员，现居武汉，CSDN博客https://blog.csdn.net/tuzongxun</a>&nbsp;&nbsp;&nbsp;&nbsp;
		  <!--<span id="busuanzi_container_site_pv">【本站累计访问量:<span id="busuanzi_value_site_pv"></span>】</span>-->
        </h2>
		
      
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-maven2" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/tzxblog/2017/11/03/maven2/" class="article-date">
  <time datetime="2017-11-03T07:09:42.000Z" itemprop="datePublished">2017-11-03</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/tzxblog/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/">开发工具</a>
  </div>

</span>
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      《maven实战》学习笔记2——maven安装（windows和eclipse插件）
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <!-- Table of Contents -->
        
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>由于我的工作中开发环境就是windows，IDE是eclipse，因此安装也只涉及和记录这两部分，在看书和动手的过程也就直接跳过其他部分。</p>
<a id="more"></a>
<h1 id="笔记"><a href="#笔记" class="headerlink" title="笔记"></a>笔记</h1><h2 id="windows中maven的安装"><a href="#windows中maven的安装" class="headerlink" title="windows中maven的安装"></a>windows中maven的安装</h2><h3 id="安装条件"><a href="#安装条件" class="headerlink" title="安装条件"></a>安装条件</h3><p>maven依赖于java，因此安装和使用maven，要先确保已安装了jdk并配置好jdk的环境变量。<br>检查jdk是否安装并配好环境变量，可以在windows的cmd窗口执行java -version查看，如果如下所示，则证明jdk安装和配置正确。</p>
<pre>
C:\Users\tzx>java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
</pre>

<h3 id="安装包下载"><a href="#安装包下载" class="headerlink" title="安装包下载"></a>安装包下载</h3><p>windows安装使用zip格式的压缩包，可从maven官网<a href="http://maven.apache.org/download.cgi" target="_blank" rel="noopener">http://maven.apache.org/download.cgi</a>下载.<br>进入上边的链接，能看到的maven最新版的安装包，如果不想要最新版，可以再页面上找到<code>Maven Releases History</code>，这是一个链接，点进去就可以看到所有的历史版本，然后选择需要的版本点击进去进行下载。</p>
<h3 id="解压安装包"><a href="#解压安装包" class="headerlink" title="解压安装包"></a>解压安装包</h3><p>这一步相信就不需多说了。</p>
<h3 id="配置环境变量（以下内容基于win8系统）"><a href="#配置环境变量（以下内容基于win8系统）" class="headerlink" title="配置环境变量（以下内容基于win8系统）"></a>配置环境变量（以下内容基于win8系统）</h3><p>和java一样，maven也需要配置环境变量，找到”我的电脑“，右键然后选择”属性“，之后依次选择”高级系统设置“、”环境变量“。<br>然后在”系统变量“选择新建，变量名填<code>M2_HOME</code>，变量值选择maven解压后的目录，例如我这里的是<code>D:\maven\apache-maven-3.2.5</code>。<br>再然后，在”系统变量“中找到<code>Path</code>属性，在末尾加上<code>%M2_HOME%\bin</code>，注意在加之前如果原本<code>Path</code>变量值的末尾没有分号结尾，需要加上英文格式的分号，然后再添加<code>%M2_HOME%\bin</code>。</p>
<h3 id="检查maven安装和环境变量的配置"><a href="#检查maven安装和环境变量的配置" class="headerlink" title="检查maven安装和环境变量的配置"></a>检查maven安装和环境变量的配置</h3><p>和检查jdk安装和环境变量配置一样，打开windows的cmd窗口，执行<code>mvn -v</code>，如果出现如下所示类似的结果，代码环境变量配置正确。</p>
<pre>
C:\Users\tzx>mvn -v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
Maven home: D:\maven\apache-maven-3.2.5
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: D:\Java\jdk1.8.0_131\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
</pre>

<h2 id="eclipse中安装maven插件"><a href="#eclipse中安装maven插件" class="headerlink" title="eclipse中安装maven插件"></a>eclipse中安装maven插件</h2><p>eclipse中安装maven插件，实际上我认为应该是属于eclipse的知识了，而且安装方式也是多种，至少我就用过两种。</p>
<h3 id="使用Install-New-Software安装"><a href="#使用Install-New-Software安装" class="headerlink" title="使用Install New Software安装"></a>使用Install New Software安装</h3><p>打开eclipse后，在最上层菜单栏找到<code>help</code>，然后在下拉菜单中找到<code>Install New Software...</code>；<br>接下来，在出现的界面中点击<code>Work with</code>后的<code>add</code>按钮，在接下来的界面中，<code>Name</code>字段中输入<code>m2eclipse</code>,<code>Location</code>中输入<code>http://download.eclipse.org/technology/m2e/releases</code>,之后选择相应的模块，一步一步<code>next</code>就好了。</p>
<h3 id="使用Eclipse-Marketplace安装"><a href="#使用Eclipse-Marketplace安装" class="headerlink" title="使用Eclipse Marketplace安装"></a>使用Eclipse Marketplace安装</h3><p>Eclipse Marketplace相当于我们通常玩手机看到的各个应用市场，这里可以理解成插件市场，可以下载各种插件。<br>同样是找到<code>help</code>，然后就可以看到<code>Eclipse Marketplace</code>，点进去然后搜索<code>m2eclipse</code>就可以搜到maven相关的eclipse插件，安装比较简单，就不做过多的说明了。<br>不过这里需要说明的是，有许多版本的eclipse中实际上有自带的eclipse插件，不过这个插件好像都是最新版本，且是不稳定版本，所以可能会出现各种各样的问题，所以并不建议使用eclipse中默认的maven插件</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://tuzongxun.gitee.io/2017/11/03/maven2/" data-id="ckxn7cxh3002kkcvhhwcye6ah" class="article-share-link">分享</a>
      
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tzxblog/tags/maven/" rel="tag">maven</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tzxblog/tags/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/" rel="tag">开发工具</a></li></ul>

    </footer>
  </div>
  
    
  <div class="comments" id="comments">
    
     
       
       
      
      
	 
  </div>
 
    
 
<script src="/tzxblog/jquery/jquery.min.js"></script>

  <div id="random_posts">
    <h2>推荐文章</h2>
    <div class="random_posts_ul">
      <script>
          var random_count =5
          var site = {BASE_URI:'/tzxblog/'};
          function load_random_posts(obj) {
              var arr=site.posts;
              if (!obj) return;
              // var count = $(obj).attr('data-count') || 6;
              for (var i, tmp, n = arr.length; n; i = Math.floor(Math.random() * n), tmp = arr[--n], arr[n] = arr[i], arr[i] = tmp);
              arr = arr.slice(0, random_count);
              var html = '<ul>';
            
              for(var j=0;j<arr.length;j++){
                var item=arr[j];
                html += '<li><strong>' + 
                item.date + ':&nbsp;&nbsp;<a href="' + (site.BASE_URI+item.uri) + '">' + 
                (item.title || item.uri) + '</a></strong>';
                if(item.excerpt){
                  html +='<div class="post-excerpt">'+item.excerpt+'</div>';
                }
                html +='</li>';
                
              }
              $(obj).html(html + '</ul>');
          }
          $('.random_posts_ul').each(function () {
              var c = this;
              if (!site.posts || !site.posts.length){
                  $.getJSON(site.BASE_URI + 'js/posts.js',function(json){site.posts = json;load_random_posts(c)});
              } 
               else{
                load_random_posts(c);
              }
          });
      </script>
    </div>
  </div>

	
<nav id="article-nav">
  
    <a href="/tzxblog/2017/11/07/maven3/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">
        
          《maven实战》学习笔记3——maven使用入门
        
      </div>
    </a>
  
  
    <a href="/tzxblog/2017/10/19/sonar1/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">使用sonar进行java代码质量管理</div>
    </a>
  
</nav>

  
</article>

</section>
           
    <aside id="sidebar">
  
    <!--微信公众号二维码-->


  
    

  
    
  
    
    <div class="widget-wrap">
    
      <div class="widget" id="toc-widget-fixed">
      
        <strong class="toc-title">文章目录</strong>
        <div class="toc-widget-list">
              <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#笔记"><span class="toc-number">2.</span> <span class="toc-text">笔记</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#windows中maven的安装"><span class="toc-number">2.1.</span> <span class="toc-text">windows中maven的安装</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装条件"><span class="toc-number">2.1.1.</span> <span class="toc-text">安装条件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#安装包下载"><span class="toc-number">2.1.2.</span> <span class="toc-text">安装包下载</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#解压安装包"><span class="toc-number">2.1.3.</span> <span class="toc-text">解压安装包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#配置环境变量（以下内容基于win8系统）"><span class="toc-number">2.1.4.</span> <span class="toc-text">配置环境变量（以下内容基于win8系统）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#检查maven安装和环境变量的配置"><span class="toc-number">2.1.5.</span> <span class="toc-text">检查maven安装和环境变量的配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#eclipse中安装maven插件"><span class="toc-number">2.2.</span> <span class="toc-text">eclipse中安装maven插件</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#使用Install-New-Software安装"><span class="toc-number">2.2.1.</span> <span class="toc-text">使用Install New Software安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#使用Eclipse-Marketplace安装"><span class="toc-number">2.2.2.</span> <span class="toc-text">使用Eclipse Marketplace安装</span></a></li></ol></li></ol></li></ol>
          </div>
      </div>
    </div>

  
    

  
    
  
    
  
    

  
</aside>

      </div>
      <footer id="footer">
  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  
  <div class="outer">
    <div id="footer-left">
      &copy; 2016 - 2021 涂宗勋&nbsp; <a href="https://beian.miit.gov.cn/#/Integrated/recordQuery" target="_blank" rel="noopener">鄂ICP备20000142号</a> |&nbsp;&nbsp;
      主题 <a href="https://github.com/giscafer/hexo-theme-cafe/" target="_blank">Cafe</a>&nbsp;|&nbsp;&nbsp;
	  <span id="busuanzi_container_site_uv">本站有效访客数<span id="busuanzi_value_site_uv"></span>人</span>
	  <span id="busuanzi_container_site_pv" >| 总访问量 <span id="busuanzi_value_site_pv"></span> 次 </span>
	  <div style="width:300px;margin:0 auto; padding:20px 0;"><a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=42010302002171"style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="http://www.tzxcode.cn/wp-content/uploads/2020/01/备案图标.png" style="float:left;"/><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">鄂公网安备 42010302002171号</p></a>
		 	</div>
    </div>
     <div id="footer-right">
      联系方式&nbsp;|&nbsp;1160569243@qq.com
    </div>
	
  </div>
</footer>
 
<script src="/tzxblog/jquery/jquery.min.js"></script>

 <script>
$(document).ready(function() {

    var int = setInterval(fixCount, 50);  // 50ms周期检测函数
    var countOffset = 20000;  // 初始化首次数据

    function fixCount() {            
       if (document.getElementById("busuanzi_container_site_pv").style.display != "none")
        {
            $("#busuanzi_value_site_pv").html(parseInt($("#busuanzi_value_site_pv").html()) + countOffset); 
            clearInterval(int);
        }                  
        if ($("#busuanzi_container_site_pv").css("display") != "none")
        {
            $("#busuanzi_value_site_uv").html(parseInt($("#busuanzi_value_site_uv").html()) + countOffset); // 加上初始数据 
            clearInterval(int); // 停止检测
        }  
    }
       	
});
</script> 
    </div>
    <nav id="mobile-nav">
  
    <a href="/tzxblog/" class="mobile-nav-link">首页</a>
  
    <a href="/tzxblog/shuoshuo/" class="mobile-nav-link">说说</a>
  
    <a href="/tzxblog/archives/" class="mobile-nav-link">归档</a>
  
    <a href="/tzxblog/collections/" class="mobile-nav-link">导航</a>
  
    <a href="/tzxblog/download/" class="mobile-nav-link">资源</a>
  
    <a href="/tzxblog/about/" class="mobile-nav-link">简历</a>
  
</nav>
    <img class="back-to-top-btn" src="/images/fly-to-top.png"/>
<script>
// Elevator script included on the page, already.
window.onload = function() {
  var elevator = new Elevator({
    selector:'.back-to-top-btn',
    element: document.querySelector('.back-to-top-btn'),
    duration: 1000 // milliseconds
  });
}
</script>
      

  

  







<!-- author:forvoid begin -->
<!-- author:forvoid begin -->

<!-- author:forvoid end -->

<!-- author:forvoid end -->



 
<script src="/tzxblog/js/is.js"></script>



  
<link rel="stylesheet" href="/tzxblog/fancybox/jquery.fancybox.css">

  
<script src="/tzxblog/fancybox/jquery.fancybox.pack.js"></script>




<script src="/tzxblog/js/script.js"></script>


<script src="/tzxblog/js/elevator.js"></script>

  </div>
</body>
</html>